package vista;
import java.awt.event.ActionListener;

import javax.swing.BorderFactory;
import javax.swing.ComboBoxModel;
import javax.swing.DefaultComboBoxModel;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.JFormattedTextField;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSeparator;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.KeyStroke;

import javax.swing.WindowConstants;
import javax.swing.border.LineBorder;
import javax.swing.table.AbstractTableModel;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel;

/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class RegistrarProducto extends javax.swing.JFrame {
	private JPanel panRegistroProducto;
	private JLabel jLabel3;
	private JLabel jLabel4;
	private JLabel jLabel5;
	private JButton btnSalirproducto;
	private JButton btnIncluirProd;
	private JButton btnNuevo;
	private JLabel lblNroCod;
	private JTextField txtNro;
	private JLabel jLabel9;
	private JScrollPane jScrollPane1;
	private JComboBox cmbProducto;
	private JButton btnEliminarprod;
	private JButton btnQuitarlistaingreprod;
	private JButton btnAgregarlistaingreprod;
	private JLabel jLabel8;
	private JLabel jLabel7;
	private JTextField txtCantIngreProd;
	private JComboBox cmbIngre;
	private JTable tblTaIngrexProd;
	private JSeparator jSeparator2;
	private JComboBox cmbCatProd;
	private JLabel jLabel6;
	private JTextField txtPrecProd;
	private JTextField txtNomProd;
	private JSeparator jSeparator1;
	private JLabel jLabel2;
	private JLabel jLabel1;

	public RegistrarProducto() {
		super();
		initGUI();
	}
	private void initGUI() {
		try {
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			getContentPane().setBackground(new java.awt.Color(0,0,0));
			getContentPane().setLayout(null);
			{
				panRegistroProducto = new JPanel();
				getContentPane().add(panRegistroProducto, "Center");
				panRegistroProducto.setLayout(null);
				panRegistroProducto.setBounds(7, 79, 488, 301);
				panRegistroProducto.setBackground(new java.awt.Color(150,182,35));
				{
					jLabel2 = new JLabel();
					panRegistroProducto.add(jLabel2);
					jLabel2.setText("Código:");
					jLabel2.setBounds(54, 11, 62, 18);
					jLabel2.setFont(new java.awt.Font("Purisa",0,14));
				}
				{
					jSeparator1 = new JSeparator();
					panRegistroProducto.add(jSeparator1);
					jSeparator1.setBounds(12, 41, 342, 12);
				}
				{
					jLabel3 = new JLabel();
					panRegistroProducto.add(jLabel3);
					jLabel3.setText("Nombre:");
					jLabel3.setBounds(49, 90, 75, 14);
					jLabel3.setFont(new java.awt.Font("Purisa",0,14));
				}
				{
					txtNomProd = new JTextField();
					panRegistroProducto.add(txtNomProd);
					txtNomProd.setBounds(119, 84, 157, 25);
					KeyStroke keyStroke = KeyStroke.getKeyStroke(Character.valueOf(' '), 0);
					this.txtNomProd.getInputMap(JComponent.WHEN_FOCUSED).put(keyStroke, "none");
				}
				{
					jLabel4 = new JLabel();
					panRegistroProducto.add(jLabel4);
					jLabel4.setText("Precio:");
					jLabel4.setBounds(64, 125, 52, 14);
					jLabel4.setFont(new java.awt.Font("Purisa",0,14));
				}
				{
					txtPrecProd = new JTextField();
					panRegistroProducto.add(txtPrecProd);
					txtPrecProd.setBounds(119, 121, 76, 21);
					KeyStroke keyStroke = KeyStroke.getKeyStroke(Character.valueOf(' '), 0);
					txtPrecProd.getInputMap(JComponent.WHEN_FOCUSED).put(keyStroke, "none");
				}
				{
					jLabel5 = new JLabel();
					panRegistroProducto.add(jLabel5);
					jLabel5.setText("Bs.");
					jLabel5.setBounds(200, 129, 27, 14);
					jLabel5.setFont(new java.awt.Font("Purisa",0,14));
				}
				{
					jLabel6 = new JLabel();
					panRegistroProducto.add(jLabel6);
					jLabel6.setText("Categoria:");
					jLabel6.setBounds(37, 55, 82, 20);
					jLabel6.setFont(new java.awt.Font("Purisa",0,14));
				}
				{
					ComboBoxModel jCmCatProdModel = 
						new DefaultComboBoxModel(
								new String[] { "Item One", "Item Two" });
					cmbCatProd = new JComboBox();
					panRegistroProducto.add(cmbCatProd);
					cmbCatProd.setModel(jCmCatProdModel);
					cmbCatProd.setBounds(119, 54, 157, 21);
				}
				{
					jSeparator2 = new JSeparator();
					panRegistroProducto.add(jSeparator2);
					jSeparator2.setBounds(12, 155, 342, 10);
				}
				{
					ComboBoxModel jCmigreModel = 
						new DefaultComboBoxModel(
								new String[] { "Item One", "Item Two" });
					cmbIngre = new JComboBox();
					panRegistroProducto.add(cmbIngre);
					cmbIngre.setModel(jCmigreModel);
					cmbIngre.setBounds(112, 161, 167, 21);
				}
				{
					txtCantIngreProd = new JTextField();
					panRegistroProducto.add(txtCantIngreProd);
					txtCantIngreProd.setBounds(350, 164, 42, 21);
					KeyStroke keyStroke = KeyStroke.getKeyStroke(Character.valueOf(' '), 0);
					txtCantIngreProd.getInputMap(JComponent.WHEN_FOCUSED).put(keyStroke, "none");
				}
				{
					jLabel7 = new JLabel();
					panRegistroProducto.add(jLabel7);
					jLabel7.setText("Ingredientes:");
					jLabel7.setBounds(9, 163, 113, 18);
					jLabel7.setFont(new java.awt.Font("Purisa",0,14));
				}
				{
					jLabel8 = new JLabel();
					panRegistroProducto.add(jLabel8);
					jLabel8.setText("Porcion:");
					jLabel8.setBounds(287, 171, 79, 14);
					jLabel8.setFont(new java.awt.Font("Purisa",0,14));
				}
				{
					btnAgregarlistaingreprod = new JButton();
					panRegistroProducto.add(btnAgregarlistaingreprod);
					btnAgregarlistaingreprod.setBounds(339, 191, 58, 50);
					btnAgregarlistaingreprod.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
					btnAgregarlistaingreprod.setOpaque(false);
					btnAgregarlistaingreprod.setIcon(new ImageIcon(getClass().getClassLoader().getResource("Imagenes/Agregar.jpg")));
					btnAgregarlistaingreprod.setActionCommand("AgregarIngrediente");
				}
				{
					btnQuitarlistaingreprod = new JButton();
					panRegistroProducto.add(btnQuitarlistaingreprod);
					btnQuitarlistaingreprod.setBounds(340, 243, 52, 50);
					btnQuitarlistaingreprod.setIcon(new ImageIcon(getClass().getClassLoader().getResource("Imagenes/Quitar.jpg")));
					btnQuitarlistaingreprod.setOpaque(false);
					btnQuitarlistaingreprod.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
					btnQuitarlistaingreprod.setActionCommand("QuitarIngrediente");
				}
				{
					btnEliminarprod = new JButton();
					panRegistroProducto.add(btnEliminarprod);
					btnEliminarprod.setIcon(new ImageIcon(getClass().getClassLoader().getResource("Imagenes/Eliminar.jpg")));
					btnEliminarprod.setOpaque(false);
					btnEliminarprod.setBorder(BorderFactory.createEmptyBorder(0,0,0,0));
					btnEliminarprod.setBounds(407, 153, 60, 45);
					btnEliminarprod.setActionCommand("Eliminar");
					btnEliminarprod.setVisible(false);
				}
				{
					btnNuevo = new JButton();
					panRegistroProducto.add(btnNuevo);
					btnNuevo.setIcon(new ImageIcon(getClass().getClassLoader().getResource("Imagenes/modificargrren.jpg")));
					btnNuevo.setOpaque(false);
					btnNuevo.setBorder(BorderFactory.createEmptyBorder(0,0,0,0));
					btnNuevo.setBounds(409, 136, 61, 49);
					btnNuevo.setActionCommand("Nuevo");
				}
				{
					btnIncluirProd = new JButton();
					panRegistroProducto.add(btnIncluirProd);
					btnIncluirProd.setIcon(new ImageIcon(getClass().getClassLoader().getResource("Imagenes/incluirblack.jpg")));
					btnIncluirProd.setOpaque(false);
					btnIncluirProd.setBorder(BorderFactory.createEmptyBorder(0,0,0,0));
					btnIncluirProd.setBounds(409, 186, 61, 50);
					btnIncluirProd.setActionCommand("Incluir");
				}
				{
					btnSalirproducto = new JButton();
					panRegistroProducto.add(btnSalirproducto);
					btnSalirproducto.setBounds(409, 242, 60, 52);
					btnSalirproducto.setIcon(new ImageIcon(getClass().getClassLoader().getResource("Imagenes/salir.jpg")));
					btnSalirproducto.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
					btnSalirproducto.setOpaque(false);
					btnSalirproducto.setActionCommand("Salir");
				}
				{
					lblNroCod = new JLabel();
					panRegistroProducto.add(lblNroCod);
					lblNroCod.setFont(new java.awt.Font("Purisa",0,14));
					lblNroCod.setBounds(122, 12, 47, 18);
				}
				{
					cmbProducto = new JComboBox();
					panRegistroProducto.add(cmbProducto);
					cmbProducto.setBounds(181, 10, 173, 21);
					cmbProducto.setActionCommand("comboBoxChanged1");
				}
				{
					jLabel9 = new JLabel();
					panRegistroProducto.add(jLabel9);
					jLabel9.setText("Nro.:");
					jLabel9.setFont(new java.awt.Font("Purisa",0,14));
					jLabel9.setBounds(301, 246, 75, 29);
				}
				{
					txtNro = new JTextField();
					panRegistroProducto.add(txtNro);
					txtNro.setBounds(313, 266, 24, 22);
				}
			}
			{
				jLabel1 = new JLabel();
				getContentPane().add(jLabel1);
				jLabel1.setText("Producto");
				jLabel1.setBounds(147, 5, 260, 73);
				jLabel1.setForeground(new java.awt.Color(255,255,255));
				jLabel1.setFont(new java.awt.Font("Purisa",1,24));
				jLabel1.setIcon(new ImageIcon(getClass().getClassLoader().getResource("Imagenes/ProductosBlack.jpg")));
			}
			{
				jScrollPane1 = new JScrollPane();
				getContentPane().add(jScrollPane1);
				jScrollPane1.setBounds(17, 287, 278, 77);
				{
	
					tblTaIngrexProd = new JTable();
					jScrollPane1.setViewportView(tblTaIngrexProd);
				}
			}
			pack();
			this.setSize(508, 414);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	public void addListener(ActionListener actionListener){
		this.btnAgregarlistaingreprod.addActionListener(actionListener);
		this.btnIncluirProd.addActionListener(actionListener);
		this.btnEliminarprod.addActionListener(actionListener);
		this.btnNuevo.addActionListener(actionListener);
		this.btnQuitarlistaingreprod.addActionListener(actionListener);
		this.btnSalirproducto.addActionListener(actionListener);
		this.cmbCatProd.addActionListener(actionListener);
		this.cmbIngre.addActionListener(actionListener);
		this.cmbProducto.addActionListener(actionListener);
	}
	
	public void setComboProducto(String[] cmbProductos){
		ComboBoxModel cmbProductosModel = new DefaultComboBoxModel(cmbProductos);
		this.cmbProducto.setModel(cmbProductosModel);
	}
	public String getComboProductos(){
		return this.cmbProducto.getSelectedItem().toString();
	}
	public void setCmbCategorias(String[] cmbCategorias){
		ComboBoxModel cmbCategoriasModel = new DefaultComboBoxModel(cmbCategorias);
		this.cmbCatProd.setModel(cmbCategoriasModel);
	}
	public String getCmbCategorias(){
		return this.cmbCatProd.getSelectedItem().toString();
	}
	public void setCmbIngredientes(String[] cmbIngredientes){
		ComboBoxModel cmbIngredientesModel = new DefaultComboBoxModel(cmbIngredientes);
		this.cmbIngre.setModel(cmbIngredientesModel);
	}
	public String getCmbIngredientes(){
		return this.cmbIngre.getSelectedItem().toString();
	}
	public void setTxtNombre(String n){
		this.txtNomProd.setText(n);
	}
	public String getTxtNombre(){
		return this.txtNomProd.getText();
	}
	public void setTxtPrecio(String p){
		this.txtPrecProd.setText(p);
	}
	public String getTxtPrecio(){
		return this.txtPrecProd.getText();
	}
	public void setTxtCantidadIngreProd(String c){
		this.txtCantIngreProd.setText(c);
	}
	public String getTxtCantidadIngreProd(){
		return this.txtCantIngreProd.getText();
	}
	public void setTablaIng(AbstractTableModel abstractTableModel) {
		this.tblTaIngrexProd.setModel(abstractTableModel);
	}
	
	public void setNro(String valor){
		this.txtNro.setText(valor);
	}
	
	public String getNro(){
		return this.txtNro.getText();
	}
	
	public void mostrarMensaje(String mensaje){
		JOptionPane.showMessageDialog(this, mensaje);		
	}
}
